<%--
    Document   : newtuychon
    Created on : Nov 21, 2011, 3:07:06 PM
    Author     : Venus
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">

<%@page import="java.util.*,Beans.ThamSoHT,Models.ThamSoHT_Model"%>
<!--
Danh sách các tham số hệ thống ở trang này :
order      areainfo     areamsg     status      arealang
newarea    areaname     save        action      arealist
enable     disable      search
-->
<script type="text/javascript">

</script>
<%
            int langid = (Integer) session.getAttribute("langid"); // ngôn ngữ hiện tại
            String dsts = " 'checksubmitmsg', 'optionexist', 'rightmsg', 'optioninfo', 'optionlist', 'optionmsg', 'optionname', 'option', 'notice', 'order', 'save' ";
            ThamSoHT[] mdsts = ThamSoHT_Model.DSThamSo(dsts, langid); // mảng chứa các tham số của trang này.
            String checksubmitmsg = mdsts[0].getTenTS();            
            String notice = mdsts[1].getTenTS();
            String option = mdsts[2].getTenTS();
            String optionexist = mdsts[3].getTenTS();
            String optioninfo = mdsts[4].getTenTS();
            String optionlist = mdsts[5].getTenTS();
            String optionmsg = mdsts[6].getTenTS();
            String optionname = mdsts[7].getTenTS();
            String order = mdsts[8].getTenTS();
            String rightmsg = mdsts[9].getTenTS();
            String save = mdsts[10].getTenTS();

            String msg = notice + "/" + optionexist;
            String msgright = notice + "/" + rightmsg;
            String msgchecksubmit = notice + "/" + checksubmitmsg;
            Vector v = (Vector) request.getAttribute("DSTC");

            int numpage = 0;// khởi tạo số trang = 0
            int vsize = v.size();
            if (vsize % 6 == 0) // mỗi trang có 6 dòng
            {
                numpage = vsize / 6;
            } else {
                numpage = vsize / 6 + 1;
            }
            String xx = (String) request.getAttribute("item"); // trang hiện tại đang xem
            int item = Integer.parseInt(xx);

%>
<h1><img style="margin-right: 13px; opacity: 0.8; margin-top: 7px;" alt="" src="../images/nhomma.png"><%=option%></h1>
<div class="cb"></div>
<div class="bloc left">
    <div class="title">
        <%=optioninfo%>
        
    </div>
        <div class="content" style=" padding-top: 25px;">
        <form name="addTC" action="">
            <div style="width: 120px; float: left; margin-left: 10px;"><%=optionname%></div>
            <input type="text" style="width: 150px;" class="text" name="tcname"/>
            <input style="margin-left: 50px" alt="<%=msg%>" class="button" lang="<%=msgright%>" id="<%=msgchecksubmit%>" onclick="CreateTC(this.alt, this.lang, this.id);" type="button" value="<%=save%>" /><br/><br/><br/>
            <label><%=optionmsg%></label>
        </form>
    </div>
</div>
<div id="DSTC" class="bloc right" style=" width: 45%; min-height: 153px;">
    <div class="title">
        <%=optionlist%>        
    </div>
    <div class="content">
        <form name="dstuychon" action="">
            <table class="mytable" border="0" cellpadding="0" cellspacing="0">
                <thead>
                    <tr>
                        <th style="width: 10%; padding-left: 30px;  "><%=order%></th>
                        <th style="width: 8%; ">
                            <a href="#" id="titledskv1" style="margin-top: 5px;" class="down" lang="<%=msgright%>"  name="1" onclick="SortTenTC(this.className, this.name, this.lang)">
                                <div style="float:left"><%=optionname%></div>
                                <div id="sortkv1" style=" margin-right: 100px;" class="down1"></div>
                            </a>
                        </th>
                    </tr>
                    <tr id="searchTC">
                        <th style=" padding-left: 30px;"><img style=" margin-top: 2px; margin-left: 3px; margin-bottom: -7px; cursor: pointer;" lang="<%=msgright%>" alt="1" src="../images/search1.png" onclick="SearchTC(this.alt, this.lang)"></th>
                        <th><input type="textbox" style=" width: 130px;" class="text" name="TENTC" ></th>
                    </tr>
                </thead>
                <tbody>
                    <%
                        for (int i = (item - 1) * 6; i < (item - 1) * 6 + 6 && i < vsize; i++) {
                            Beans.TuyChon TC = (Beans.TuyChon) v.elementAt(i);
                    %>
                    <tr>
                        <td style="padding-left: 40px; "><%= i + 1%></td>
                        <td class="TenKV"><a href="#" name="<%=TC.getMaTC()  %>" lang="<%=msgright%>" onclick="ShowLangTC(this.name, this.lang)"><%= TC.getTenTC() %></a></td>

                    </tr>
                    <%  }
                    %>
                </tbody>
            </table>
            <div class="pagination" style=" margin-top: 20px;">
                <%
                    int trang = 1;
                    if (item > 1) {
                        trang = item - 1;
                    }
                %>
                <%
                    if (vsize > 6) {%>
                        <a href="#" class="prev"  name="<%= trang%>" lang="<%=msgright%>" onclick="Option( this.name, this.lang)">«</a>
                <%
                        for (int c = 1; c <= numpage; c++) {
                            if (c != item) {
                %>              <a href="#"  name="<%= c%>" lang="<%=msgright%>" onclick="Option( this.name, this.lang)" ><%= c%></a>
                <%          } else {%><a class="current"> <%= c%></a> <% }
                        }
                %>
                <%      if (item + 1 <= numpage) {
                            trang = item + 1;
                        } else {
                            trang = item;
                        }
                %>
                        <a href="#" class="next"  name="<%= trang%>" lang="<%=msgright%>" onclick="Option( this.name, this.lang)">»</a>
                <%  }
                %>
            </div>
        </form>
    </div>
</div>
<div id="TClang" style=" width: 49%; overflow: hidden; " >
</div>
